﻿
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>企业文件记录</title>
<!--link to style-->
<link rel="stylesheet" href="css/adapt.css" />

<link rel="stylesheet" href="../css/font-awesome.min.css" />
<!--<link rel="stylesheet" href="css/adapt.css" />-->
<!--//End link to style-->
<script type="text/javascript" src="../js/jquery.js"></script>
</head>
<body>
	<div class="Body clearfix">
		<div class="catlog">
			<span class="cat_block">当前位置</span> <span
				class="cat_block icon-chevron-right">文件记录</span> <span
				class="cat_block icon-chevron-right">查看所有文件记录</span>
		</div>
		<table class="table">
			<tr class="fir_tit">
				<td class="firline">文件编号</td>
				<td class="firline">文件名</td>
				<td class="firline">文件大小</td>
				<td class="firline">文件格式</td>
				<td class="firline">文件类型</td>
				<td class="firline">操作</td>
			</tr>
			<!--  
                        <tr class="lineTr">
                            <td class="reguLine">001</td>
                            <td class="reguLine">1.txt</td>
                            <td class="reguLine">22kb</td>
                            <td class="reguLine">txt</td>
                            <td class="reguLine">文本</td>
                            <td class="reguLine">admin</td>
                            <td class="reguLine"><span class="icon-trash span"></span></td>
                        </tr>
						-->

		</table>

	</div>



	<script>
	$(function () {
		
		$.ajax({
            type: "Post",
            url: "/hr_doc/servlet/DocumServlet",
            data: {
           	 Command:"list",
           	 
            },
            async: false,
            dataType: "json",
            success: function (d) {
				console.log(d);
               	if(d.code == 1){
               		var result = d.result;
               		
               		var str = "";
               		for(var i = 0;i<result.length;i++){
               			
               			var item = result[i];
               			str += '<tr class="lineTr">';
               			str += '<td class="reguLine">'+item.id+'</td>';
               			str += '<td class="reguLine"><a href="'+item.docpath+'" download='+item.docname+'>'+item.docname+'</a></td>';
               			str += '<td class="reguLine">'+item.docsize+'KB</td>';
               			str += '<td class="reguLine">'+item.doctype+'</td>';
               			str += '<td class="reguLine">'+item.docform+'</td>';
                        //str += '<td class="reguLine"><a href="'+item.docpath+'" download="'+item.docname+'"></a></td>';
                        str += '<td class="reguLine"><span class="icon-trash span" onclick="deleteDoc('+item.id+')"></span></td>';
                        str += '</tr>';
                        
               		}
               		$(".table").append(str);
               	}else{
               		alert("暂无数据");
               	}
            },
            error: function (xmlHttpRequest, textStatus, errorThrown) {
            	
            }
        });
    	
    });
	
	function deleteDoc(id){
		
		$.ajax({
            type: "Post",
            url: "/hr_doc/servlet/DocumServlet",
            data: {
           	 Command:"delete",
           	 id:id
            },
            async: false,
            dataType: "json",
            success: function (d) {
				console.log(d);
				if(d.code == 1){
					alert(d.result);
					location.href = "/hr_doc/subPage/documRecord.html";
               	}else{
               		alert(d.error);
               	}
            },
            error: function (xmlHttpRequest, textStatus, errorThrown) {
            	
            }
        });
		
	};
	</script>
</body>
</html>
